package com.warski.wonderfires.page.led;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;

import com.warski.wonderfires.R;

import java.util.ArrayList;

public class TabFragment extends Fragment {

    public ArrayList<String> mList;
    private Handler mHandler;
    public TabFragment(ArrayList<String> list, Handler handler) {
        mList = list;
        mHandler = handler;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_tab, container, false);

        RecyclerView recyclerView = rootView.findViewById(R.id.recycler);

        LooperLayoutManager layoutManager = new LooperLayoutManager(mHandler);
        layoutManager.setLooperEnable(true);
        layoutManager.setMaxFlingVelocity(recyclerView,1);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setAdapter(new RecyclerAdapter(mList));
        return rootView;
    }

}
